package com.blocks.blocks;

import com.blocks.ScriptBlocksApplication;
import com.blocks.gui.BlockListGroup;
import com.blocks.model.BlockSides;
import com.blocks.script.ScriptUtils;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.scene.Spatial;

public class ColorBlock extends Block{
	
	public ColorBlock() {	
		super();
	}
	public ColorBlock(String name, Long masterId) {
		super(name,masterId);
		this.setBlockListGroup(BlockListGroup.GAME);
	}
	
	@Override
	public void init() {
		
		 super.init();	
		
	}
		


	@Override
	public void updateLogicalState(float tpf) {
		
		super.updateLogicalState(tpf);
		if(this.isPowered()){			
			switch (getFrequency(getBlockSides())) {
			case 0:
				setColor(ColorRGBA.Red);
				break;
			case 1:
				setColor(ColorRGBA.Orange);
				break;
			case 2:
				setColor(ColorRGBA.Yellow);
				break;
			case 3:
				setColor(ColorRGBA.Green);
				break;
			
			case 4:
				setColor(ColorRGBA.Blue);
				break;	
			case 5:
				setColor(ColorRGBA.Magenta);
				break;
			default:
				setColor(ColorRGBA.White);
				break;
			}
			
		} else {
			setColor(ColorRGBA.Gray);
		}
	}

}
